<template>
	<view style="padding: 20rpx;">
		<u-navbar :title="title"></u-navbar>
		<rich-text :nodes="nodes"></rich-text>
	</view>
</template>

<script setup lang="ts">
	import { ref } from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import hotel from '../../../api/hotel.js';
	let title = ref('')
	let nodes = ref('')
	const getHotelDetail = async (id: string,cid ?: string) => {
		const res = await hotel.getHotelDetail({
			hotel_id: id,
			room_type: -2
		})
		let idx = res.data.hotel_cater.find(v => v.id == cid)
		nodes.value = title.value == '基地详情' ? res.data.content: idx.c_content
	}
	onLoad((op: any) => {
		if(op.type == 0) {
			title.value = '基地详情'
			getHotelDetail(op.id)
		}else{
			title.value = '餐饮详情'
			getHotelDetail(op.id,op.cid)
		}
		
	})
</script>

<style>
</style>